package dtos;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.eclipse.persistence.annotations.Mutable;


public class MeanOfTransportationDTO {
	
	private int transportationID;

	private int cost;

	private String departureTime;

	private int duration;

	private TransportationTypeDTO transportationType;

	private TripDTO trip;

	private List<PersonalizedTPDTO> personalizedTps1;

	private List<PersonalizedTPDTO> personalizedTps2;

	private List<PredefinedTPDTO> predefinedTps1;

	private List<PredefinedTPDTO> predefinedTps2;

	public MeanOfTransportationDTO() {
	}

	public int getTransportationID() {
		return this.transportationID;
	}

	public String getDescription(){
		String res;
		if (this.transportationType.getType() == "flight"){
			res = this.transportationType.getType()+" "+this.transportationType.getCompany()+" "+this.transportationType.getFlightClass()+" Departure time : "+this.departureTime+" Duration :"+this.duration;
		}else{
			if(this.transportationType.getType() == "train"){
				res = this.transportationType.getType()+" "+this.transportationType.getCompany()+" "+this.transportationType.getTrainClass()+" Departure time : "+this.departureTime+" Duration :"+this.duration;
				
			}
			else{
				res = this.transportationType.getType()+" "+this.transportationType.getCompany()+" "+this.transportationType.getVehicleType()+" Departure time : "+this.departureTime+" Duration :"+this.duration;
				
			}
		}
		return res;
	}
	
	public void setTransportationID(int transportationID) {
		this.transportationID = transportationID;
	}

	public int getCost() {
		return this.cost;
	}

	public void setCost(int cost) {
		this.cost = cost;
	}

	public String getDepartureTime() {
		return this.departureTime;
	}

	public void setDepartureTime(String departureTime) {
		this.departureTime = departureTime;
	}

	public int getDuration() {
		return this.duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}

	public TransportationTypeDTO getTransportationType() {
		return this.transportationType;
	}

	public void setTransportationType(TransportationTypeDTO transportationType) {
		this.transportationType = transportationType;
	}

	public TripDTO getTrip() {
		return this.trip;
	}

	public void setTrip(TripDTO trip) {
		this.trip = trip;
	}

	public List<PersonalizedTPDTO> getPersonalizedTps1() {
		return this.personalizedTps1;
	}

	public void setPersonalizedTps1(List<PersonalizedTPDTO> personalizedTps1) {
		this.personalizedTps1 = personalizedTps1;
	}

	public PersonalizedTPDTO addPersonalizedTps1(PersonalizedTPDTO personalizedTps1) {
		getPersonalizedTps1().add(personalizedTps1);
		personalizedTps1.setMeanOfTransportation1(this);

		return personalizedTps1;
	}

	public PersonalizedTPDTO removePersonalizedTps1(PersonalizedTPDTO personalizedTps1) {
		getPersonalizedTps1().remove(personalizedTps1);
		personalizedTps1.setMeanOfTransportation1(null);

		return personalizedTps1;
	}

	public List<PersonalizedTPDTO> getPersonalizedTps2() {
		return this.personalizedTps2;
	}

	public void setPersonalizedTps2(List<PersonalizedTPDTO> personalizedTps2) {
		this.personalizedTps2 = personalizedTps2;
	}

	public PersonalizedTPDTO addPersonalizedTps2(PersonalizedTPDTO personalizedTps2) {
		getPersonalizedTps2().add(personalizedTps2);
		personalizedTps2.setMeanOfTransportation2(this);

		return personalizedTps2;
	}

	public PersonalizedTPDTO removePersonalizedTps2(PersonalizedTPDTO personalizedTps2) {
		getPersonalizedTps2().remove(personalizedTps2);
		personalizedTps2.setMeanOfTransportation2(null);

		return personalizedTps2;
	}

	public List<PredefinedTPDTO> getPredefinedTps1() {
		return this.predefinedTps1;
	}

	public void setPredefinedTps1(List<PredefinedTPDTO> predefinedTps1) {
		this.predefinedTps1 = predefinedTps1;
	}

	public PredefinedTPDTO addPredefinedTps1(PredefinedTPDTO predefinedTps1) {
		getPredefinedTps1().add(predefinedTps1);
		predefinedTps1.setMeanOfTransportation1(this);

		return predefinedTps1;
	}

	public PredefinedTPDTO removePredefinedTps1(PredefinedTPDTO predefinedTps1) {
		getPredefinedTps1().remove(predefinedTps1);
		predefinedTps1.setMeanOfTransportation1(null);

		return predefinedTps1;
	}

	public List<PredefinedTPDTO> getPredefinedTps2() {
		return this.predefinedTps2;
	}

	public void setPredefinedTps2(List<PredefinedTPDTO> predefinedTps2) {
		this.predefinedTps2 = predefinedTps2;
	}

	public PredefinedTPDTO addPredefinedTps2(PredefinedTPDTO predefinedTps2) {
		getPredefinedTps2().add(predefinedTps2);
		predefinedTps2.setMeanOfTransportation2(this);

		return predefinedTps2;
	}

	public PredefinedTPDTO removePredefinedTps2(PredefinedTPDTO predefinedTps2) {
		getPredefinedTps2().remove(predefinedTps2);
		predefinedTps2.setMeanOfTransportation2(null);

		return predefinedTps2;
	}

	@Override
	public String toString() {
		
		
		return 
				transportationType.toString()+  ", Departure Time: " + departureTime+", Duration: " + duration +" min"+", cost :" + cost+"euros" ;
			
	}
	



}
